package cm.config;


import cm.constant.MchPropertiesDTO;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * 配置文件配置
 * ce:
 *   hh:
 *     mch:
 *       id1：
 *         sec:
 *         key:
 *         id:
 *       id2：
 *         sec:
 *         key:
 *         id:
 *
 *         test
 *
 */
@Data
@Component
@ConfigurationProperties(prefix = "ce.hh")
public class MchProperties {
    private Map<String, MchPropertiesDTO> mch = new HashMap<>();

    public MchPropertiesDTO getMchById(String id){
        MchPropertiesDTO mchPropertiesDTO = mch.get(id);
        if (Objects.isNull(mchPropertiesDTO)){
            mchPropertiesDTO = new MchPropertiesDTO();
        }
        return  mchPropertiesDTO;
    }
}
